﻿// =================================================================== 
// 业务逻辑层(GDIT.BLL)
//====================================================================
// 文件：BCollegeInfo.cs
// 项目名称：学院网站
// 创建时间：2012-08-12
// 负责人：ChenZhiGang
//引用DevExpress.Data.Filtering，DevExpress.Xpo程序集
// 程序集介绍：学院概况操作逻辑
// ===================================================================
using DevExpress.Xpo;
using DevExpress.Data.Filtering;
using GDIT.Base.LogHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GDIT.Model;

namespace GDIT.BLL
{
    public class BCollegeInfo
    {
        private Pattern.DALAbstractFactory dataFactory = DataProvider.defaultProvider;

        /// <summary>
        /// 新增校园概况
        /// </summary>
        /// <param name="detailMenu">需要新增的校园概况对象</param>
        /// <returns>1：新增成功 0：新增失败</returns>
        public bool InsertCollegeInfo(Mtb_CollegeInfo collegeInfo)
        {
            Logger.Info(String.Format("校园概况标题[{0}]", collegeInfo.CollegeInfoName));
            int result = dataFactory.DALCollegeInfoProvider.InsertCollegeInfo(collegeInfo);
            if (result == 1)
            {
                Logger.Info("Insert success");
                return true;
            }
            else
            {
                Logger.Info("Insert false");
                return false;
            }
        }

        /// <summary>
        /// 删除校园概况
        /// </summary>
        /// <param name="detailMenu">需要删除的校园概况对象</param>
        /// <returns>1：删除成功 0:删除失败</returns>
        public bool DeleteCollegeInfo(Mtb_CollegeInfo collegeInfo)
        {
            Logger.Info(String.Format("校园概况标题[{0}]", collegeInfo.CollegeInfoName));
            int result = dataFactory.DALCollegeInfoProvider.DeleteCollegeInfo(collegeInfo);
            if (result == 1)
            {
                Logger.Info("Delete success");
                return true;
            }
            else
            {
                Logger.Info("Delete false");
                return false;
            }
        }

        /// <summary>
        /// 更新校园概况
        /// </summary>
        /// <param name="detailMenu">需要更新的校园概况对象</param>
        /// <returns>1：更新成功 0：更新失败</returns>
        public bool UpdateCollegeInfo(Mtb_CollegeInfo collegeInfo)
        {
            Logger.Info(String.Format("校园概况标题[{0}]", collegeInfo.CollegeInfoName));
            int result = dataFactory.DALCollegeInfoProvider.UpdateCollegeInfo(collegeInfo);
            if (result == 1)
            {
                Logger.Info("Update success");
                return true;
            }
            else
            {
                Logger.Info("Update false");
                return false;
            }
        }

        /// <summary>
        /// 查询单一校园概况
        /// </summary>
        /// <param name="CollegeInfo">需要查询的校园概况对象</param>
        /// <returns>所需的校园概况对象</returns>
        public Mtb_CollegeInfo SelectCollegeInfoByCollegeInfo(string name)
        {
            return dataFactory.DALCollegeInfoProvider.SelectCollegeInfoByCollegeInfo(name);
        }

        /// <summary>
        /// 查询所有的校园概况信息
        /// </summary>
        /// <returns>所有的校园概况信息</returns>
        public XPCollection SelectAllCollegeInfo(string collegeType)
        {
            return dataFactory.DALCollegeInfoProvider.SelectAllCollegeInfo(collegeType);
        }
    }
}
